# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=qt6-qtmultimedia
pkgver=6.3.1
pkgrel=0
pkgdesc="Classes for audio, video, radio and camera functionality"
url="https://qt.io/"
arch="all"
license="LGPL-2.1-only AND LGPL-3.0-only AND GPL-3.0-only AND Qt-GPL-exception-1.0"
depends_dev="
	alsa-lib-dev
	gst-plugins-base-dev
	gstreamer-dev
	libxv-dev
	pulseaudio-dev
	qt6-qtbase-dev
	qt6-qtdeclarative-dev
	qt6-qtshadertools-dev
	qt6-qtsvg-dev
	"
makedepends="$depends_dev
	cmake
	perl
	samurai
	"
subpackages="$pkgname-dev"
builddir="$srcdir/qtmultimedia-everywhere-src-${pkgver/_/-}"

case $pkgver in
	*_alpha*|*_beta*|*_rc*) _rel=development_releases;;
	*) _rel=official_releases;;
esac

source="https://download.qt.io/$_rel/qt/${pkgver%.*}/${pkgver/_/-}/submodules/qtmultimedia-everywhere-src-${pkgver/_/-}.tar.xz"

build() {
	# alsa disabled due to build failure for now
	# src/multimedia/platform/alsa/qalsaaudiosink.cpp:270:5: error: 'timeStamp' was not declared in this scope
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DINSTALL_BINDIR=lib/qt6/bin \
		-DINSTALL_DOCDIR=share/doc/qt6 \
		-DINSTALL_ARCHDATADIR=lib/qt6 \
		-DINSTALL_DATADIR=share/qt6 \
		-DINSTALL_INCLUDEDIR=include/qt6 \
		-DINSTALL_MKSPECSDIR=lib/qt6/mkspecs \
		-DINSTALL_EXAMPLESDIR=share/doc/qt6/examples \
		-DQT_FEATURE_alsa=OFF \
		-DQT_FEATURE_pulseaudio=ON
	cmake --build build --parallel
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}
sha512sums="
c557a8577a28df1997a07643c125033d6ab0e1d64a2e67b659f51d11d29c5634e7ea1264ad31705889e138521b65b74761ac68399dd94637ced8c5d6d07e03c3  qtmultimedia-everywhere-src-6.3.1.tar.xz
"
